package com.vcc.data.mapper;

import com.mybatisflex.core.BaseMapper;
import com.vcc.data.entity.BossRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Optional;

@Mapper
public interface BossRoleMapper extends BaseMapper<BossRole> {

    @Select("select r.* from vcc_boss_user_boss_role ur left join vcc_boss_role r on ur.boss_role_id = r.id where ur.user_id = #{userId}")
    Optional<BossRole> findByUserId(@Param("userId") Long userId);

    @Select("select r.* from vcc_boss_user_boss_role ur left join vcc_boss_role r on ur.boss_role_id = r.id where ur.user_id = #{userId}")
    List<BossRole> findAllByUserId(@Param("userId") Long userId);
}
